package org.zsk.cfl.servicetask;

import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.Expression;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>
 * </p>
 *
 * @author zsk
 * @date 2020/11/17 上午10:03
 */
@Component("cancelCurProcServiceTask")
@Slf4j
public class CancelProcServiceTask implements JavaDelegate {

    @Autowired
    RuntimeService runtimeService;

    @Override
    public void execute(DelegateExecution delegateExecution) {
        String procId=delegateExecution.getProcessInstanceId();
        log.debug("取消流程服务任务-cancelCurProcServiceTask，流程id：{}",procId);
        runtimeService.deleteProcessInstance(procId,"用户及时完成任务或定时邮件提醒已发送");
    }
}
